{template 'web/_header'}
{template 'web/allorder/common_search'}
{template 'web/allorder/goldshop_tabs'}
<form action="" method="post" enctype="multipart/form-data">
    <div class='panel panel-default'>
        <div class='panel-heading' >
            <!--  记录管理 (数量: {$total} 条) -->
        </div>
        <div class='panel-body'>

            <table class="table">
                <thead>
                    <tr>
                        <th style="width:60px;">ID</th>
                        <th style='width:220px;'>订单编号</th>
                        <th style='width:400px;'>商品</th>
                        <th style="width:100px;">兑换码</th>
                        <th style='width:80px;'>类型</th>
                        <th style='width:100px;'>用户信息</th>
                        <th style='width:100px;'>消耗</th>
                        <th style='width:150px;'>运费</th>
                        <th style='width:150px;'>兑换时间</th>
                        <th style='width:100px;' >状态</th>
                        <th style='width:100px;' >支付状态</th>
                        <th style='width:100px;' >运费状态</th>
                        <th style="">操作</th>
                    </tr>
                </thead>
                <tbody>
                    {loop $list $row}
                <td>{$row['logid']}</td>
                <td>{$row['logno']}</td>
                <td><img src='{php echo tomedia($row['thumb'])}' style='width:30px;height:30px;padding1px;border:1px solid #ccc' /> {$row['title']}</td>
                <td>{$row['eno']}</td>
                <td>{if $row['goodstype']==1}
                    <span class='label label-danger'>抽奖</span>
                    {else}
                    <span class='label label-primary'>兑换</span>
                    {/if}
                </td>
                <td><img src='{$row['avatar']}' style='width:30px;height:30px;padding1px;border:1px solid #ccc' /> {$row['nickname']}</td>
                <td>{if $row['gold_card']>0}-{$row['gold_card']}金币<br/>{/if}
                    {if $row['credit2']>0}-{$row['credit2']}现金{/if}
                    {if $row['weixin']>0}-{$row['weixin']}现金{/if}
                </td>
                <td>
                    {if $row['dispatchmoney']==0}
                    免运费
                    {else}
                    运费：{$row['dispatchmoney']}元
                    {/if}
                </td>
                <td>{php echo date('Y-m-d H:i:s',$row['createtime']);}</td>
                <td>
                    {if $row['status']==2}
                    <span class='label label-success'>待发货</span>
                    {elseif $row['status']==3}
                    <span class='label label-danger'>已发货</span>
                    {elseif $row['status']==4}
                    <span class='label label-default'>已完成</span>
                    {/if}
                </td>
                <td>
                    {if $row['paytype']==-1}
                    <span class='label label-default'>无需支付</span>
                    {else}
                    {if $row['paytype']==0}
                    {if $row['paystatus']==0}
                    <span class='label label-default'>余额未支付</span>
                    {else}
                    <span class='label label-warning'>余额已支付</span>
                    {/if}
                    {elseif $row['paytype']==1}
                    {if $row['paystatus']==0}
                    <span class='label label-default'>微信未支付</span>
                    {else}
                    <span class='label label-warning'>微信已支付</span>
                    {/if}
                    {/if}
                    {/if}
                </td>
                <td>
                    {if $row['dispatchstatus']==-1}
                    <span class='label label-default'>无需支付</span>
                    {elseif $row['dispatchstatus']==0}
                    <span class='label label-default'>未支付</span>
                    {elseif $row['dispatchstatus']==1}
                    <span class='label label-success'>已支付</span>
                    {/if}
                </td>
                <td>
                    <a class='btn btn-default' href="{php echo $this->createWebUrl('allorder', array('op' => 'detail','p'=>'goldshop_list','id' => $row['logid']))}" title='详情' ><i class='fa fa-edit'></i></a>
                    {ifp 'creditshop.log.exchange'}
                    {if $row['canexchange']}
                    <a class='btn btn-default' href="javascript:;" onclick='exchange({php echo json_encode($row['address'])})' title='确认兑换' ><i class='fa fa-exchange'></i></a>
                    {/if}
                    {/if}
                </td>
                </tr>
                {/loop}
                </tbody>
            </table>
            {$pager}
        </div>
    </div>
</form>
{template 'web/allorder/goldshop_modal'}
<script language='javascript'>
            function exchange(address){
            $('#modal-exchange').find(':input[name=id]').val(address.logid);
                    $('#express').val('');
                    $('#expresscom').val('');
                    $(':input[name=expresssn]').val('');
                    if (address.realname){
            $('#expressform').show();
                    $('#realname').html(address.realname);
                    $('#mobile').html(address.mobile);
                    $('#address').html(address.province + address.city + address.area + " " + address.address);
            } else{
            $('#expressform1').show();
            }
            $('#modal-exchange').modal();
            }
</script>
<script language='javascript'>
    $(function (){

    $("#express").change(function () {
    var obj = $(this);
            var sel = obj.find("option:selected").attr("data-name");
            $("#expresscom").val(sel);
    });
    })
</script>
{template 'web/_footer'}
